import {AfterViewInit, Component, OnInit} from "@angular/core";
import {BaseComponent} from "../base.component";
import {ArrayModel} from "../model/ArrayModel";
import {ms_article} from "../model/ms_article";
import {AnnouncementService} from "./announcement.service";


declare const UM:any;

@Component({
    selector: 'my-rightContent',
    templateUrl:"./announcement.component.html",
    styleUrls:["./announcement.component.css"]

})
export class AnnouncementComponent extends BaseComponent implements AfterViewInit{


    _datasource:ArrayModel<ms_article>=new ArrayModel(ms_article);

    _dataFromID:ms_article=new ms_article();

    _data:ms_article=new ms_article();

    _UM:any=null;


    constructor(private service:AnnouncementService){
        super();
        this._data=service.data;
    }


    ngAfterViewInit(): void {
        UM.clearCache("myEditor");
        this._UM = UM.getEditor('myEditor');
    }


    handleSubmit(){
        this.service.createAnnouncement(this._data);
    }

}
